package top.hyz.hrm.hystrix;

import org.springframework.stereotype.Component;
import top.hyz.hrm.AjaxResult;
import top.hyz.hrm.CourseDoc;
import top.hyz.hrm.client.IFeignClient;

/**
 * @ClassName FallbackFactory
 * @Description Feign网关的熔断回调类
 * @Author 韩雨泽
 * @Date 2021/1/21-15:11
 * @Version 1.0
 */
@Component
public class MyFallbackFactory implements feign.hystrix.FallbackFactory<IFeignClient> {
    @Override
    public IFeignClient create(Throwable cause) {
        return new IFeignClient() {
            @Override
            public AjaxResult onLineCourse(CourseDoc courseDoc) {
                return  AjaxResult.me().setSuccess(false).setMessage("系统繁忙，请稍后再试");
            }
        };
    }
}
